package helpers;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

public abstract class SelfRemoting<T extends Remote> implements Remote {

	private final T selfRemote;

	@SuppressWarnings("unchecked")
	public SelfRemoting() throws RemoteException {
		selfRemote = (T) UnicastRemoteObject.exportObject(this, 0);
	}

	public T getSelfRemote() {
		return selfRemote;
	}
}
